
//
//  UIBaButtonItem+Extension.swift
//  swiftImitationWeibo
//
//  Created by 杨果果 on 16/7/10.
//  Copyright © 2016年 yang. All rights reserved.
//

import UIKit
//自定义UIBarButtonItem
extension UIBarButtonItem {
convenience init(title: String, target: AnyObject?, action:Selector ){
    self.init()
    let button =  UIButton()
    button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
    button.setTitle(title, forState: .Normal)
    button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
    button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
    button.titleLabel?.font = UIFont.systemFontOfSize(14)
    button.sizeToFit()
    customView = button
    }
}